﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace AnyRepMembershipProvider
{
    public class MembershipUserHelpers : IMembershipUserHelpers
    {
        /// <summary>
        /// Creates a MembershipUser object from an AnyRepMembershipUser object
        /// </summary>
        /// <param name="ProviderName">The Provider Name</param>
        /// <param name="user">AnyRepMembershipUser Object</param>
        public MembershipUser GetMembershipUserFromAnyRepMembershipUser(string ProviderName, AnyRepMembershipUser user)
        {
            MembershipUser newUser = new MembershipUser(ProviderName,
                user.Username,
                user.UserId,
                user.Email,
                user.PasswordQuestion,
                user.Comment,
                user.IsApproved,
                user.IsLockedOut,
                user.CreatedDate.GetValueOrDefault(),
                user.LastLoginDate.GetValueOrDefault(),
                user.LastActivityDate.GetValueOrDefault(),
                user.LastPasswordChangedDate.GetValueOrDefault(),
                user.LastLockoutDate.GetValueOrDefault());

            return newUser;
        }
    }
}
